Skip to content

feat: add telemetry schemas and client#941

Merged
Hweinstock merged 1 commit intoaws:mainfrom
Hweinstock:feat/telemetry-schemas
Apr 24, 2026
Merged

feat: add telemetry schemas and client#941
Hweinstock merged 1 commit intoaws:mainfrom
Hweinstock:feat/telemetry-schemas

Conversation

@Hweinstock
Copy link
Copy Markdown
Contributor

Description

Adds telemetry infrastructure for CLI command metrics. Includes:

  • Metric sink abstraction (MetricSink interface, CompositeSink, OtelMetricSink, InMemorySink). We can add on a file system sink for the audit command.
  • Telemetry client with withCommandRun wrapper that records success/failure/cancel with duration, error classification, and command-specific attributes. This handles the heavy lifting for wiring up telemetry, allowing us to wrap flows with the middleware.
  • Schema-driven PII protection: safeSchema() compile-time guard rejects z.string() fields in command schemas; resource attributes are regex/length-constrained. Runtime tests verify both layers.
  • Error classification mapping errors to safe enum categories (ConfigError, CredentialsError, PackagingError, etc.) without leaking error messages
  • Telemetry config (config.ts) combining preference resolution (env var / global config / default) and OTel resource attribute resolution
  • Telemetry never affects CLI behavior — all recording/flush/shutdown paths are guarded with try-catch

Key Decisions:

  • decouple telemetry schemas from internal representation.
  • provide runtime and compile time guards against arbitrary information leakage in telemetry.
  • leverage flexible sink interface for future extensions of telemetry destination.

Notes:

  • This PR does NOT start emitting telemetry. It only defines the client we can use to start doing that, and sets up an architecture for the schemas.

Related Issue

Closes #

Documentation PR

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update
  • Other (please describe):

Testing

How have you tested the change?

  • I ran npm run test:unit and npm run test:integ
  • I ran npm run typecheck
  • I ran npm run lint
  • If I modified src/assets/, I ran npm run test:update-snapshots and committed the updated snapshots

Checklist

  • I have read the CONTRIBUTING document
  • I have added any necessary tests that prove my fix is effective or my feature works
  • I have updated the documentation accordingly
  • I have added an appropriate example to the documentation to outline the feature, or no new docs are needed
  • My changes generate no new warnings
  • Any dependent changes have been merged and published

@github-actions
Copy link
Copy Markdown
Contributor

Package Tarball

aws-agentcore-0.9.1.tgz

How to install

npm install https://github.com/aws/agentcore-cli/releases/download/pr-941-tarball/aws-agentcore-0.9.1.tgz

@Hweinstock Hweinstock force-pushed the feat/telemetry-schemas branch from 358bb73 to f318528 Compare April 23, 2026 20:59
@github-actions github-actions Bot added size/xl PR size: XL and removed size/xl PR size: XL labels Apr 23, 2026
@Hweinstock Hweinstock force-pushed the feat/telemetry-schemas branch from f318528 to cde420f Compare April 23, 2026 21:16
@github-actions github-actions Bot added size/xl PR size: XL and removed size/xl PR size: XL labels Apr 23, 2026
@Hweinstock Hweinstock changed the title feat: add telemetry schemas and resource resolver feat: add telemetry schemas and client Apr 23, 2026
@Hweinstock Hweinstock marked this pull request as ready for review April 23, 2026 23:19
@Hweinstock Hweinstock requested a review from a team April 23, 2026 23:19
@Hweinstock Hweinstock merged commit 7c37fa6 into aws:main Apr 24, 2026
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/xl PR size: XL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants